home *** CD-ROM | disk | FTP | other *** search
/ Die Speccy' 97 / Die Speccy' 97.iso / amiga_system / the_aminet / comm / bbs / trinitybbs20.lha / OLP / tradewars.lzh / Tradewars! < prev    next >
Text File  |  1992-05-23  |  7KB  |  372 lines

  1. /*   Tradewars Amiga Version 1.0
  2.      Written By Jim Holzknecht
  3.      Original Concept By Chris Sherrick
  4.      Trinity BBS Amiga Version
  5.      Greets To The Jaguar:
  6.      Sysop Of The Danger Zone (502)/448-1155 (300-38.4k Baud [HST V.42])  */
  7.  
  8. options results
  9. bufferflush
  10. getuser 1
  11. name = result
  12. getuser 27
  13. linelength = result
  14. PF = 'olp:TRADEWARS/'
  15. PFP = 'olp:TRADEWARS/players/'
  16. PFU = 'olp:TRADEWARS/universe/'
  17. PFT = 'olp:TRADEWARS/teams/'
  18. space = '                                        '
  19. date = date('U')
  20. signal on error
  21. signal on syntax
  22. signal on ioerr
  23. transmit '\f1\n1'
  24. if linelength = 80 then do
  25.  transmit '                             \c6\u1                     \u0'
  26.  transmit '                             \c1\z6 T R A D E   W A R S \z0'
  27. end
  28. if linelength ~= 80 then transmit '         \c6\r1 T R A D E   W A R S \r0'
  29. transmit '\c2'
  30. an = 'By Jim Holzknecht'
  31. call cnter
  32. an = "(c) 1990,1991 Hokey Software"
  33. call cnter
  34. an = "Modified For Trinity BBS By Rodney Martin"
  35. call cnter
  36. transmit '\c7'
  37. an = 'The Danger Zone (502)/448-1155'
  38. call cnter
  39. mem = storage();if mem<250000 then do
  40. transmit 'Sorry, there is less than 250,000 bytes of memory!'
  41. transmit 'Try again later...'
  42. exit
  43. end
  44. call open file, (PF'autodata.tw'), 'R'
  45. am.1 = readln(file)
  46. am.2 = readln(file)
  47. am.3 = readln(file)
  48. am.4 = readln(file)
  49. am.5 = readln(file)
  50. am.6 = readln(file)
  51. am.7 = readln(file)
  52. call close file
  53. filen = PF'var.tw'
  54. call open file, (filen), 'R'
  55. c.1 = readln(file)
  56. c.2 = readln(file)
  57. call close file
  58.  
  59. yoopa:
  60. call checkdate
  61. spawn 'olp:twmain'
  62. exit
  63.  
  64. key:
  65. sendstring '\c6(\c1-*-\c6)\c3'
  66. getchar
  67. transmit '\h9'
  68. return
  69.  
  70. checkdate:
  71. If exists(PF'date.tw') then do
  72.   call open file, (PF'date.tw'), 'R'
  73.   tt.1 = readln(file)
  74.   call close file
  75.   if tt.1 = date('U') then return
  76. end
  77.  
  78. maint:
  79. transmit '\n1\c6[\c1Now Doing Daily Maintenance\c6]\c3'
  80.  
  81. dlete:
  82. transmit '\c2Deleting Inactive Players...'
  83. call teloop
  84. ur = 0
  85. x = 0
  86. cop = 0
  87. yoop:
  88. x = x + 1
  89. if x > 40 then signal dlete2
  90. user = PFP'p' x
  91. call open file, (user), 'R'
  92. pl.x.1 = readln(file)
  93. pl.x.2 = readln(file)
  94. pl.x.3 = readln(file)
  95. pl.x.4 = readln(file)
  96. pl.x.5 = readln(file)
  97. pl.x.6 = readln(file)
  98. pl.x.7 = readln(file)
  99. pl.x.8 = readln(file)
  100. pl.x.9 = readln(file)
  101. pl.x.10 = readln(file)
  102. pl.x.11 = readln(file)
  103. pl.x.12 = readln(file)
  104. pl.x.13 = readln(file)
  105. pl.x.14 = readln(file)
  106. pl.x.15 = readln(file)
  107. call close file
  108. signal yoop
  109.  
  110. dlete2:
  111. cop = cop + 1
  112. if cop > 40 then signal interest
  113. bo = pl.cop.14
  114. if left(pl.cop.1,1) = '.' then bo = 0
  115. if bo = '' then bo = 0
  116. datc = date('c')
  117. temp = left(pl.cop.1,1)
  118. x = datc - bo
  119. if serialn=pl.cop.15 then signal dlete2
  120. if x > am.6  & temp ~= '.' then do
  121.   transmit 'Deleting '||trim(pl.cop.1)||'...'
  122.   a = pl.cop.1' ['pl.cop.2'] was deleted for inactivity.'
  123.   call newspaperopen
  124. if exists(PFU'fighters') then do
  125.   call open file, (PFU'fighters'), 'R'
  126.   y=0
  127.   do until eof(file)
  128.   y=y+1
  129.   pd.y=readln(file)
  130.   if word(pd.y,1)=pl.cop.15 then do
  131.   i=y
  132.   call cc
  133.   end
  134.   end
  135.   call close file
  136.   call searchun
  137. end
  138.   pl.cop.3 = 0
  139.   pl.cop.4 = 0
  140.   pl.cop.7 = 0
  141.   pl.cop.15= 0
  142.   if pl.cop.2 > 0 then do
  143.     teamnumber = pl.cop.2
  144.     if tle.teamnumber = pl.cop.1 then do
  145.       call disband2
  146.     end
  147.   end   
  148.   pl.cop.1 = '..................'
  149.   pl.cop.2 = 0
  150.   x = cop
  151.   call saveuser
  152.   if exists(PF''cop) then address command 'delete 'PF''cop
  153.   if exists(PF''cop'.msg') then address command 'delete 'PF''cop'.msg'
  154. end  
  155. signal dlete2    
  156.  
  157. interest:
  158. c.1 = 5
  159. if am.3 = 1 then do
  160.   transmit '\n1Setting Today''s Interest Rate...'
  161.   c.1 = random(1,10,time('s'))
  162. end
  163. transmit 'Posting Interest...'
  164. cop = 0
  165. inter:
  166. cop = cop + 1
  167. if cop = 41 then signal interend
  168. if pl.cop.13 > 0 then do
  169.   x = pl.cop.13
  170.   temp = c.1 / 100
  171.   y = trunc(x*temp)
  172.   x = x + y
  173.   pl.cop.13 = x 
  174.   x = cop
  175.   call saveuser
  176. end
  177. signal inter
  178. interend:
  179. c.2 = 90
  180. if am.4 = 1 then do
  181.   transmit '\n1Setting Today''s Cabal Bounty...'
  182.   temp = random(1,50,time('s'))
  183.   c.2 = 50 + temp
  184. end
  185. fixnewspaper:  /* Crazy Cad gets credit here...*/
  186. xx = 30
  187. if xx = 0 then signal done 
  188. filen = PF||'paper.tw'
  189. if ~exists(filen) then signal done
  190. call open(short,filen, 'R');s=0
  191. do until eof(short)=1
  192.   s=s+1
  193.   line.s = readln(short)
  194. end
  195. s=s-1
  196. call close short
  197. if xx ~=0 & xx<s then do
  198.   transmit '\c1Fixing Newspaper...'
  199.   signal off error
  200.   call open(short,filen,'W')
  201.   do i =(s-xx+1) to s
  202.     writeln(short,line.i)
  203.   end
  204.   call close short
  205.   signal on error
  206. end
  207. if exists(PF'3ALL.msg') then do
  208.   address command 'delete 'PF'3ALL.msg'
  209. end
  210. if exists(PF'2ALL.msg') then do
  211.   address command 'rename 'PF'2ALL.msg as 'PF'3ALL.msg'
  212. end
  213. if exists(PF'1ALL.msg') then do
  214.   address command 'rename 'PF'1ALL.msg as 'PF'2ALL.msg'
  215. end
  216.  
  217. if exists(PF'cabal') then do
  218. call open file, (PF'cabal')
  219. z = readln(file)
  220. call close file
  221. a = z' Cabal were killed yesterday.'
  222. call newspaperopen
  223. address command 'delete 'PF'cabal'
  224. end
  225.  
  226. done:
  227. if exists(PF'date.tw') then address command 'delete 'PF'date.tw'
  228. fle = PF'date.tw'
  229. call open file, (fle), 'W'
  230. call writeln file, date('U')
  231. call close file
  232. if exists(PF'var.tw') then address command 'delete 'PF'var.tw'
  233. fle = PF'var.tw'
  234. call open file, (fle), 'W'
  235. call writeln file, c.1
  236. call writeln file, c.2
  237. call close file
  238. endcheck:
  239. return
  240.  
  241. error:
  242. transmit '\n1Error in Line #' SIGL
  243. exit
  244. syntax:
  245. a = SIGL
  246. transmit '\n1Syntax Error In Line #' a
  247. transmit 'Line Reads : >'sourceline(a)'<'
  248. exit
  249. ioerr:
  250. transmit '\n1I/O Error In Line #' SIGL
  251. exit
  252.  
  253. saveuser:
  254. call open file, (PFP'p' x), 'W'
  255. call writeln file, pl.x.1
  256. call writeln file, pl.x.2
  257. call writeln file, pl.x.3
  258. call writeln file, pl.x.4
  259. call writeln file, pl.x.5
  260. call writeln file, pl.x.6
  261. call writeln file, pl.x.7
  262. call writeln file, pl.x.8
  263. call writeln file, pl.x.9
  264. call writeln file, pl.x.10
  265. call writeln file, pl.x.11
  266. call writeln file, pl.x.12
  267. call writeln file, pl.x.13
  268. call writeln file, pl.x.14
  269. call writeln file, pl.x.15
  270. call close file
  271. return
  272.  
  273. cnter:
  274. sendstring center(an,linelength)
  275. return
  276.  
  277. newspaperopen:
  278. if exists(PF'paper.tw') then do
  279.   call close file
  280.   call open file, (PF'paper.tw'), 'A'
  281.   call writeln file, a
  282.   call close file
  283.   return
  284. end
  285. call close file
  286. call open file, (PF'paper.tw'), 'W'
  287. call writeln file, a
  288. call close file
  289. return
  290.  
  291. disband2:
  292. teamnumber = pl.cop.2
  293. transmit '\n1\c5Disbanding Team...'
  294. x = 0
  295. do x = 1 to 40
  296. if pl.x.2 = teamnumber then do
  297. pl.x.2 = 0
  298. call saveuser
  299. end
  300. end
  301. a = tn.teamnumber' disbanded due to the deletion of the captain.'
  302. call newspaperopen
  303. tn.teamnumber = '..'
  304. call saveteam
  305.  
  306. teloop:
  307. x = 0
  308. teloop2:
  309. x=x+1
  310. if x>10 then return
  311. fle=PFT't' x
  312. call open file, (fle), 'R'
  313. tn.x = readln(file)
  314. tle.x = readln(file)
  315. tpd.x = readln(file)
  316. call close file
  317. signal teloop2
  318.  
  319. saveteam:
  320. fle = PFT't 'teamnumber
  321. call open file, (fle), 'W'
  322. call writeln file, tn.teamnumber
  323. call writeln file, tle.teamnumber
  324. call writeln file, tpd.teamnumber
  325. call close file
  326. return
  327.  
  328. searchun:
  329. i=0
  330. searchun2:
  331. i=i+1
  332. if i>y then return
  333. if word(pd.i,1)=pl.cop.15 then do
  334. call removef
  335. i=i-1
  336. end
  337. signal searchun2
  338.  
  339. cc:
  340. sector=word(pd.i,2)
  341. call open(sctor,PFU'tws'sector, 'R')
  342. do yop=1 to 26
  343. sd.yop=readln(sctor)
  344. end
  345. call close(sctor)
  346. sd.9=99
  347. call open(sctor,PFU'tws'sector, 'W')
  348. do yop=1 to 26
  349. call writeln(sctor, sd.yop)
  350. end
  351. call close(sctor)
  352. return
  353.  
  354. removef:
  355. z=0
  356. removef2:
  357. z=z+1
  358. temp=y+1
  359. if z=temp then signal removef3
  360. temp=i+z
  361. an=i+z-1
  362. pd.an=pd.temp
  363. signal removef2
  364. removef3:
  365. y=y-2
  366. call open file, (PFU'fighters'), 'W'
  367. do z=1 to y
  368. call writeln file, pd.z
  369. end
  370. call close file
  371. return
  372.